package com.leo.customer.service.impl

import com.leo.customer.entity.dao.PostDao
import com.leo.customer.entity.pojo.Organize
import com.leo.customer.entity.pojo.Post
import com.leo.customer.entity.pojo.User
import com.leo.customer.manager.RedisManager
import com.leo.customer.service.PostService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import java.time.ZoneOffset

@Service
class PostServiceImpl : PostService {

    @Autowired
    lateinit var redisManager: RedisManager

    @Autowired
    lateinit var postDao: PostDao

    /**
     * 报名
     */
    override fun signUp(post: Post, user: User):Boolean {
        return false
    }

    override fun createPost(post: Post): Post {
        val savedPost = postDao.save(post)
        val time = post.endTime.toEpochSecond(ZoneOffset.of("+8"))
        println(time)
        println(System.currentTimeMillis()/1000)
        return savedPost
    }

    override fun findPostById(id: Int): Post {
        return postDao.getOne(id)
    }
}
